<?php

include_once './util/db/Conn.php';
include_once './util/ArrayList.php';
include_once './util/db/model/SupplierBrand.php';


class SupplierBrandDBUtil {
	protected $dbConn;
	private $tabName = "supplier_brand";
	function __construct() {
		$this->dbConn = new DBConn ();
		@header ( "Content-Type:text/html; charset=utf-8" );
	}
	
	public function open() {
		$this->dbConn->open ();
	
	}
	
	public function close() {
		$this->dbConn->close ();
	}
	
	public function queryAll() {
		$this->open ();
		$arrayList = new ArrayList ();
		$sql = "select * from `$this->tabName`";
		$result = mysql_query ( $sql );
		while ( $row = @mysql_fetch_array ( $result ) ) {
			$arrayList->add ( $this->fill ( $row ) );
		}
		$this->close ();
		return $arrayList;
	}
	
	/**
	 * Enter description here ...
	 */
	private function fill($row) {
	
		$supplierBrand = new SupplierBrand ();
		$supplierBrand->setSb_id ( $row ['sb_id'] );
		$supplierBrand->setCm_id( $row ['cm_id'] );
		$supplierBrand->setLogo_name ( $row ['logo_name'] );
		$supplierBrand->setLogo_name_en( $row ['logo_name_en'] );
		$supplierBrand->setPic ( $row ['pic'] );

		return $supplierBrand;
	}
	

}
?>